package taller2.view.components;

import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.JToggleButton;

import taller2.controller.MainEdittingMenu.AreaSizeListener;
import taller2.view.windows.MainWindows.MainWindow;

public class ResizeBar extends JPanel{
	private static final long serialVersionUID = 1L;
	private JSlider areaSizeSelector;
	private JToggleButton areaSizeButton;
	protected MainWindow window;
	
	public ResizeBar(MainWindow window){
		this.window = window;
		
		AreaSizeListener listenerSize = createAreaSizeListener();
		this.areaSizeSelector = new JSlider(10, 100);
		areaSizeSelector.addChangeListener(listenerSize);
		add(this.areaSizeSelector);
		
		this.areaSizeButton = new JToggleButton("resize");
		this.areaSizeButton.addActionListener(listenerSize);	
		add(this.areaSizeButton);
    }
    
	protected AreaSizeListener createAreaSizeListener(){
		return (new AreaSizeListener(this.window,this));
	}	

	public void unselectButtons(){
		areaSizeButton.setSelected(false);
	}
}
